package org.nlp.algo.classifier.svm;

import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.google.common.io.Files;

/**
 * 读取特征文件，主要是要特征值
 * @author kongxp
 *
 */
public class ReadFeature {

	//数据特征列表
	public static Map<String,String> features = new HashMap<String,String>();
	//TODO KONGXP 静态初始化函数给为init的方式进行调用
	static{
		try {
			List<String> ls = Files.readLines(new File("./words/feature2.txt"),Charset.forName("UTF-8"));
			for (String value : ls) {
				features.put(value.split(" ")[1], value.split(" ")[0]);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	public static void main(String[] args) {
		System.out.println(features.size());
	}
	
}
